<?php
namespace app\common\model;

class Admin extends Base
{
    protected $name = 'admin';

    // 启用||禁用
    public function setStatus($id){
        $info = $this->getFind(['id' => $id])['data'];

        if($info['status'] == 0){
            $status       = 1;
            $back['flag'] = 1;
            $back['msg']  = '启用成功';
        }else{
            $status       = 0;
            $back['flag'] = 0;
            $back['msg']  = '禁用成功';
        }

        $data = [
            'id'      => $id,
            'status'  => $status,
        ];
        
        $this->update($data);
        return $back;
    }
}